Skip to content

Translate LiveObjects objects UTS test specs to Kotlin tests#1222

Draft
sacOO7 wants to merge 4 commits into
feature/liveobjects-uts-testsfrom
feature/uts-liveobjects-unit-tests
Draft

Translate LiveObjects objects UTS test specs to Kotlin tests#1222
sacOO7 wants to merge 4 commits into
feature/liveobjects-uts-testsfrom
feature/uts-liveobjects-unit-tests

Conversation

@sacOO7

@sacOO7 sacOO7 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Translates the objects (LiveObjects) UTS unit specs into runnable Kotlin tests in the uts
module, using the uts-to-kotlin skill. Of the 15 objects/unit specs, 10 are translated
(181 tests)
and 5 are blocked by missing internal implementation (documented, not silently
skipped).

This is translate-only: every test compiles (./gradlew :uts:compileTestKotlin is green). Most
run only once the LiveObjects engine (OBJECT_SYNC processing + RealtimeObject.get()) lands; the
message-layer and value-type construction tests run today.

Base branch: feature/liveobjects-uts-tests.

What's included

10 translated spec files — 181 @Test methods

Spec (objects/unit/…) Test class Tests Layer
instance.md InstanceTest 20 Public view (Instance)
path_object.md PathObjectTest 30 Public view (PathObject)
path_object_mutations.md PathObjectMutationsTest 13 Public view
path_object_subscribe.md PathObjectSubscribeTest 22 Public view
live_counter_api.md LiveCounterApiTest 7 Public view
live_map_api.md LiveMapApiTest 15 Public view
live_object_subscribe.md LiveObjectSubscribeTest 11 Public view
public_object_message.md PublicObjectMessageTest 13 Public message layer
realtime_object.md RealtimeObjectTest 33 Mixed (public get() + sync events)
value_types.md ValueTypesTest 17 Mixed (public create surface)

Each test carries a verbatim @UTS objects/unit/… tag tracing it to the source spec point. All files
follow the uts conventions (no star imports, runTest, shared helpers.kt).

Deviationsuts/src/test/kotlin/io/ably/lib/uts/deviations.md
Per-test divergences where ably-java (a typed SDK) differs from the spec's dynamic API, e.g.:

  • wrong-type Instance cast throws IllegalStateException rather than ErrorInfo 92007;
  • value()/size() partitioned off the wrong-typed view (not expressible);
  • compact() unimplemented → compactJson() used;
  • invalid-input cases the type system rejects at compile time;
  • internal wire-message-shape assertions adapted to observable public effects.

Blocked specsuts/src/test/kotlin/io/ably/lib/uts/private_deviations.md
The 5 specs that could not be translated, with the reasons and a recommended path forward.

The 5 blocked specs

live_counter.md, live_map.md, object_id.md, objects_pool.md, parent_references.md assert on the
internal CRDT graph (live nodes + applyOperation, siteTimeserials, the ObjectsPool, object-id
generation, parent references). Two blockers:

  1. Not implemented yet (primary). :liveobjects currently ships only the public view layer; the
    CRDT engine these specs test does not exist (ObjectsPool, generateObjectId, applyOperation, … =
    0 references). There is nothing to assert against.
  2. Cross-module internal visibility (secondary). Once implemented, those symbols will be Kotlin
    internal and unreachable from the :uts test module at compile time.

private_deviations.md lays out the realistic options for when the engine lands — the recommended one
(to keep tests under uts/unit) is a java-test-fixtures bridge in :liveobjects exposing a small
public inspection surface; the lowest-ceremony alternative is authoring them in :liveobjects/src/test.

Notes / caveats

  • Translate-only: tests are not run in CI here; the gate is compilation. deviations.md entries that
    document SDK behaviour become live once the engine is implemented.
  • A few not-expressible cases (inputs the typed signatures reject at compile time) are intentionally
    documented no-op test bodies, paired with a // DEVIATION note + deviations.md entry.
  • LiveCounterApiTest / LiveMapApiTest contain a few wire-shape assertions read reflectively /
    via observable round-trip; these are unverified until the SDK publish path lands (flagged in the code).

How it was produced

Driven by the uts-to-kotlin skill (per-spec: read the objects mapping doc + infra, translate, compile
once for the whole module, review against the spec). The bulk batch was fanned out with a multi-agent
workflow (one agent per spec, parallel), then compiled and fixed centrally.

Testing

./gradlew :uts:compileTestKotlin   # BUILD SUCCESSFUL — all 10 classes compile

Update — integration & proxy tiers added

Extends this PR beyond the unit tier: the direct-sandbox integration and proxy integration objects specs are now translated. Still translate-only (compiles; runs once the LiveObjects engine lands and against the sandbox). With these, all non-blocked objects specs across all three tiers are translated — only the 5 internal-graph unit specs remain blocked (above).

Integration tier — direct sandbox (integration/standard/liveobjects/)

Real-sandbox happy path: connect → sync → create/mutate via PathObject → verify propagation to a second client; no fault injection. Each case runs once per protocol variant (JSON + msgpack) via a useBinaryProtocol @ParameterizedTest.

Spec (objects/integration/…) Test class Spec cases Spec points
objects_lifecycle_test.md ObjectsLifecycleTest 6 RTO23, RTPO15, RTPO17
objects_sync_test.md ObjectsSyncTest 4 RTO4, RTO5, RTO17

Clients hit the nonprod sandbox (sandbox.realtime.ably-nonprod.net via ProxyManager.sandboxRealtimeHost); a throwaway app is provisioned with SandboxApp in @BeforeAll/@AfterAll.

Proxy tier — sandbox + fault injection (integration/proxy/liveobjects/)

Routes the SDK through the programmable uts-proxy to inject transport faults (disconnect mid-OBJECT_SYNC, delayed sync, server-initiated DETACHED, channel ERRORFAILED). JSON-only (the proxy inspects only text frames).

Spec (objects/integration/proxy/…) Test class Spec cases Spec points
objects_faults.md ObjectsFaultsTest 5 RTO5a2, RTO7, RTO8, RTO17, RTO20e

Other changes

  • Integration REST fixture helperintegration/standard/liveobjects/helpers.kt: provisionObjectsViaRest(...) plus op/value builders, the ably-java translation of standard_test_pool.md's provision_objects_via_rest. Built to the V2 objects REST contract (POST /channels/{ch}/object, payload-key ops, no {messages} envelope), targeting the nonprod sandbox host via restHost. Used by RTPO15's rest-provisioned-data-sync case; compiles against :java only (public AblyRest).
  • junit-jupiter-params added to uts/build.gradle.kts — enables the protocol-variant @ParameterizedTest in the integration tier (version managed by the JUnit BOM already on the test classpath).
  • objects-mapping.md §14 — documents the integration REST-helper mapping in the uts-to-kotlin skill reference.

Related

The V2 + nonprod-host alignment of the UTS source spec is tracked upstream in ably/specification#497 (the provision_objects_via_rest host/shape and the objects integration client endpoints).

Testing

./gradlew :uts:compileTestKotlin   # BUILD SUCCESSFUL — unit + integration + proxy all compile

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fcc0d0d4-977a-4c00-ab57-ecad4ddec993

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/uts-liveobjects-unit-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot temporarily deployed to staging/pull/1222/features June 25, 2026 21:00 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/1222/javadoc June 25, 2026 21:01 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/1222/features June 26, 2026 09:51 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/1222/javadoc June 26, 2026 09:52 Inactive
@sacOO7 sacOO7 changed the title Generated unit tests using uts-to-kotlin skill Translate LiveObjects objects UTS unit specs to Kotlin (10/15 specs, 181 tests) Jun 26, 2026
@sacOO7 sacOO7 changed the title Translate LiveObjects objects UTS unit specs to Kotlin (10/15 specs, 181 tests) Translate LiveObjects objects UTS unit specs to Kotlin tests Jun 26, 2026
…s.md

Record the five objects/unit UTS specs (live_counter, live_map, object_id,
objects_pool, parent_references) that cannot be translated into the :uts
module. They assert on the internal CRDT graph (ObjectsPool, live nodes,
applyOperation, object-id generation, parent references), which is (a) not yet
implemented in :liveobjects and (b) Kotlin-`internal`, so unreachable from the
:uts test module at compile time.

Covers: status of all 15 objects/unit specs (10 translated, 5 blocked), why
these target internals, the two blockers, and the realistic visibility options
(java-test-fixtures bridge, tests in :liveobjects/src/test, or reflection) with
their trade-offs and a recommendation.
@sacOO7 sacOO7 force-pushed the feature/uts-liveobjects-unit-tests branch from 18a9d0c to 43a3ab2 Compare June 26, 2026 09:54
@github-actions github-actions Bot temporarily deployed to staging/pull/1222/features June 26, 2026 09:55 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/1222/javadoc June 26, 2026 09:56 Inactive
Add the integration-tier translation of standard_test_pool.md's REST fixture
provisioning (`provision_objects_via_rest`) under
uts/.../integration/standard/liveobjects/helpers.kt: `provisionObjectsViaRest`
plus op builders (mapSet/mapRemove/mapCreate/counterCreate/counterInc) and value
builders (string/number/boolean/bytes/objectId).

The helper follows the LiveObjects V2 objects REST API (per the OpenAPI), not the
legacy pseudocode: POST /channels/{channel}/object (singular), body is a single
operation or a bare array (no "messages" envelope), each op identified by its
payload key with an objectId/path target. Compiles against :java only
(AblyRest + HttpUtils); used by objects/integration/RTPO15.

Document it in the uts-to-kotlin skill's objects-mapping.md as a new section
("14. Integration-test helpers"), promoted out of the unit-only internal-graph
section, with the TOC renumbered accordingly.
@github-actions github-actions Bot temporarily deployed to staging/pull/1222/features June 26, 2026 10:52 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/1222/javadoc June 26, 2026 10:54 Inactive
@sacOO7 sacOO7 changed the title Translate LiveObjects objects UTS unit specs to Kotlin tests Translate LiveObjects objects UTS test specs to Kotlin tests Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant